package aygx.spring.boot.principle;

import aygx.spring.boot.principle.entity.Mouse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;

/**
 * @author 暗影孤星
 * @date 2022/7/24 23:51
 * @description
 */
@Slf4j
@ComponentScan("aygx")
public class Content2 {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext content = new AnnotationConfigApplicationContext(Content2.class);

        // 后注册的覆盖前注册的
        content.register(Mouse.class);
        content.registerBean("mouse", Mouse.class, 0);
        content.registerBean("mouse", Mouse.class, 1);
        content.registerBean("mouse", Mouse.class, 2);

        for (String beanDefinitionName : content.getBeanDefinitionNames()) {
            // bean name is mouse
            log.info("bean name is {}", beanDefinitionName);
        }
    }
}
